/**
 * @author will
 */
exports.SmoothBrowserButtonBlock = GL2.Node.subclass({
	
	classname: 'SmoothBrowserButtonBlock',
	
    initialize: function(id, inactive, active, disabled, callback){
        if (typeof active == 'undefined') 
            active = inactive;
        if (typeof disabled == 'undefined') 
            disabled = inactive;
        this._inactiveFrame = inactive;
        this._activeFrame = active;
        this._disabledFrame = disabled;
		this._id = id;
		
		this._callback = callback;
        
        this._enabled = true;
        this._target = null;
        
        
        //set the animation frame..
        //this._itemNode = new GL2.Sprite();
        this._itemNode=GLFactory.getSprite(null,null,null,null,null)//new GL2.Sprite(); 
        var a = new GL2.Animation();
        a.pushFrame(this._inactiveFrame);
        this._itemNode.setAnimation(a);        
        this.addChild(this._itemNode);
        
    },
	
	inactivate: function() {
		//when button is idle and not doing anything
		this._itemNode.getAnimation().setFrame(0,this._inactiveFrame);
	},
	
	
	activate: function() {
		//when the button is pressed..
		this._itemNode.getAnimation().setFrame(0,this._activeFrame);		
		//call function
			
	},	
	
	getId: function() {
		return this._id;
	},
    
	getSize: function() {
		return this._inactiveFrame.getSize();
	},	
	
	getAnchor: function() {
		return this._inactiveFrame.getAnchor();
	},	
    
    touched: function(){
		this.inactivate();
    	this._callback();
    },
    

});
